<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>微信安全支付</title>
<link rel="stylesheet" href="/carworld_weixin/css/wxpay.css" />
</head>
<body style="background-color: #f3f3f3;">
	<div class="header">
		茉德精品火锅-消费订单
		<div class="price">¥ ${recharge.reality_pay_amount,"0.00"}</div>
	</div>
	<div class="body">
		<div class="fl">收款方</div>
		<div class="fr">茉德精品火锅</div>
	</div>
	<div class="container">
		<a href="javascript:;" class="btn-success">微信安全支付</a>
	</div>
	<script>
		function onBridgeReady() {
			WeixinJSBridge.invoke('getBrandWCPayRequest', {
				"appId" : "${finalpackage.appId}",
				"timeStamp" : "${finalpackage.timeStamp}",
				"nonceStr" : "${finalpackage.nonceStr}",
				"package" : "${finalpackage.package}",
				"signType" : "MD5",
				"paySign" : "${finalpackage.paySign}"
			},
			
			function(res) {
				if(res.err_msg == "get_brand_wcpay_request:ok"){
					alert("恭喜您，充值成功~");
					window.location.href="/carworld_weixin/user/userPage";
			    }else if(res.err_msg == "get_brand_wcpay_request:error"){
					alert("充值失败，请在公众号对话框留言联系客服~");
					window.location.href="/carworld_weixin/user/userPage";
				}else{
					alert("充值失败返回主页，请在公众号对话框留言联系客服~");
					window.location.href="/carworld_weixin/user/userPage";
				}
			}
			
			);
		}
		  
		
		if (typeof WeixinJSBridge == "undefined") {
			if (document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
						false);
			} else if (document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		} else {
			onBridgeReady();
		}
	</script>
</body>
</html>
